wrapper: recursion bug on build_function_spec

detecting custom objects is hard, added function to help