Fix bug in open, save and save as