Bug fix in writing n-best file