fixed nesting, separator check, reattaching