Add debugFunc setting for createFunction, fix tests