Fixing generation bugs