Fixed a bug in generating phrases