Fix bug that causes exceptions when file is blank

Downcasing a non-existant filename was causing problems.