Fixed crash on opening a file