Fix missing null check

-Code clean up