small null check fixes