fix to javascript for updating value if nil