Fix bugs related to generators

Change-Id: Id1926ffd58220384ccde138677c07a4f62aa5822