added defensive checks for missing environment properties