fixed bug with opening nonexistent files