fix sys.ji build segfault regression

This reverts commits 372f928ca4230e099d1766b92a714ccfd4332fb1,
f1ee0cd11b94fd18614789b44dab024a78b22f5a,
682d5bcbd2cdb925b957e77fa3220421f51b67bd,
c8e707cf321da23124d0667ae6b1a5b85ead3318.