fixed calculation copy-length bug