Fixed erroneous null check