Detect NODE_ENV correctly