Code cleanup.
Fixed NPE.