fix typeError (null is not an object)

this issue happens get before set