Fixed possible NPE due to java sucking.