added truncate
check for negative length