added check for empty file as per ticket #501