added checks for None in the models