Environment checking fix.

Was causing numerous error calls.  Ended up crashing a server.  This Seems to have fixed it.
Merge pull request #2 from michaelcurry/master

Add another check for ENVIRONMENT.