added additional null check