Fixed handling for empty files