Fix underflow bug