Fix regression in stubbing functions introduced in python 3 changes