Extra null value check. Not sure why this is needed in the subquery implementation and not regular queries. Bug elsewhere?