Fixed the NullPointerException of issue #77.

I fixed the NullPointerException of issue #77. Please review and merge this.