Fixed bug in k-best for grammar.