Fixed environment detection to delegate through Express.