Fixed a Java error-checking bug.