fixed menu deletion

moved some lines of code