adding isnil checks