Fix bug when repairing collapsed shapes