Added a needed null check