corrected a variable check

updating the check to use the object's property instead of the undefined variable