added checking nil or not