fixed error with empty result set