Fix a bug that sweep() corrupts a doubly linked list.