corrects variable existence check to supress PHP warnings