Fix bug on file open.