Fix a few bugs with calling Java methods