fix errors, allow 0 in interval loop but use while for <0