fix bug about total length