Fixed null pointer exception