fix recursion depth error