Fixing some issues with function generation.