fixed dofunccall to return correct type