fix second thength calculation