Fix decorators to make replacing function work in both old and new style calls.