Change drawing tools when item reaches certain point

A strange request, but I want a maximum amount of shapes to be drawn on my map, and once this threshold has been reached, the only drawing tools i want to be able to be accessed, is the select button, and the delete button. However once I change the drawing tools, a bug (i think its a bug) appears, when i can’t delete any of my shapes, select them or do anything with them. Once I click on them however, the shape suddenly dissapears, apart from the popup, which i simply cant delete.

My AddFeatures:

    function addFeatures(features, map) {
        if(!(shapes.length + 1 > wagens.length)){
            console.log(shapes.length)
            console.log(wagens.length)
        features.forEach(function(feature) {
            shapes.push(new Shape(
                feature.id,
                feature.geometry.coordinates[0],
                map
            ));
        });
        // updateAndShowTotalArea();
        if(shapes.length + 1 > wagens.length){
            alert("U heeft uw maximum aantal gebieden bereikt. Probeer andere gebieden te verschuiven, of verwijder een gebied")
            console.log(currentDrawingTool)
            map.removeControl(currentDrawingTool.current)
            sleep(1000)
            let ttDrawingTools = getDrawingTools()
            currentDrawingTool.current = ttDrawingTools
            map.addControl(ttDrawingTools, 'top-left');
            ttDrawingTools.on('tomtom.drawingtools.created', function(event) {
                addFeatures(event.data.features, map, ttDrawingTools);
            });
    
            ttDrawingTools.on('tomtom.drawingtools.deleted', function(event) {
                deleteFeatures(event.data.features, map);
            });
    
            ttDrawingTools.on('tomtom.drawingtools.changed', function(event) {
                updateFeatures(event.data.features);
            });
    
            ttDrawingTools.on('tomtom.drawingtools.dragged', function(event) {
                // area also needs to be updated because it changes while dragging
                // the reason is the way how spherical earth is reproduced on flat surface
                updateFeatures(event.data.features);
            });
        }
        }
    else{
        alert("U heeft uw maximum aantal gebieden bereikt. Probeer andere gebieden te verschuiven, of verwijder een gebied")
    }
}

Is there somebody who can help me out?