remove orphaned elements