fix a few issues with recursion - redo object recursion a bit, make it hopefully more bulletproof