Move linefit() call after done()