fix minor jcache bug and add assertions