patch to avoid values <0