Fixed the "remove end of B array before merging" bug