Fixed bugs in save as and open