handle undefined case
refine test
change logic to safe with null or undefined
now can safe with none object
update history