changed length computation