check for null in when