Fix a bug when elaborating for-generate