fix TypeError (null is not an object)

this issue happens get before set