Fix bug that prevented switching environments.

Change-Id: I8ee8e60983cacf841780c05d92c3d83b14595e50
Closes-Bug: #1297268
Merge "Fix bug that prevented switching environments."