Fixes #717

Needed to make sure to not pass a null value to the where clause, which was causing the exception.