added another error check (if file size is 0)