Improved environment checks