bugfix in testing vertices for NAN, thanks to Laurent for the bug report