Added a null check