checking underflow errors