fixes #23, correct lookback algorism