avoid integer overflow by resetting to 0