Fixed some bugs in JavaType and ref packages.