Fixed issue with empty result sets throwing null reference exceptions.