fixed bugs in sentence generation