Fixes #717, needed to make sure to not pass a null value to the where clause, which was causing the exception.