Fixed opening of files bugs.