adds an if to check if the file is empty on read