A solution for problems with file handling