changed NA check 'if'