Fixed error where invalid file would throw exception