ugly partial fix to lookahead algorithm; closer but not quite there yet... -sai