fix debug mode using env variables