Fixed null pointer exception which resulted from sloppy refactoring.