properly handling when the application is in maintenance mode