Fixed environment object null pointer exception