Fix linespace and timgen to have correct start and end sample