fixed orphan detection