fixed bug with files open