Improve behavior on opening files