add isTypeSafe method for backup
fix some bugs (partially)
try to fix global value unsafe load/store, untested