some fixes to avoid the recursion issue