Fixes to file opening.