Fix length adding bug