Fixed a segfault when reopening files with object types