Some fixes related to typeconversion in the Java backend