fix a variety of weird problems related to capitalization of package name, improve generics