fix bug in invitation factory