fix allocation nil error