fix some index bugs, implement super slow cyk