Fixed bug on invalid files