Fixed the NullPointer Exception