Adjusted query to not return NULL. Fixes #216.