checked for empty result and exit