Fixed some errors when opening