Fixed the Null-Pointer exception