fixed Null Pointer Bug