Maybe this could be pushed upstream to AF?