fix null pointer exception when DEBUG_ENABLED is true