Fixed the null check