bug fix in new tailfit function