backported special_fn branch fix from MCP2