Attempting to fix bugs in Java/Javascript conversion.