Added a null check on the models