Fixed dir save bug + added check for file ending