Improve performance of getEnvironment() for unknown environment IDs.