a bunch of jb/immutable-related fixes