fixed bugs in file handling