Fix debug env checking