added checking to see if the file is empty