Added check for the overflow.