fixing function generator bugs