Fixed a NullPointerException bug.