handle nan and infinity in where clauses