Fixed bug on file opening