Fixes for issues I've found working on real project with jcodemodel

See https://github.com/sviperll/adt4j to understand my use case.