Fix env and unprotect