handle bad files better