Fix Null Pointer bug