Is homequit a global variable. You know that if you have int homequit = 0; it won't be reinitialized at every start, but you have initialize it yourself instead.