added a null check