fix null pointer exception in env-init