Fix the environment detection and hide the debug bar on staging