Fixed the case when 'used' becomes less than zero

Before this fix, if more time passed than the duration of a bucket,
'used' value becomes less than zero. As a fix, 'used' is set to zero
when it is less than zero.