improve code to avoid issues under the menu safe zone