added a null check to the last fix