Fix EnvironmentError handler crashiness