Fix failing unit tests on some JVMs