safeguard against negative remainders