Deal with null returns with query

@jsteiner @gabebw