Fixed check to account for overflow.