function generation fixing