Fixed NULL pointer exception.