Bug fix: Check value of variable rather than variable itself