eliminating 'negative length' warnings