fix for recursive depth cycles