fix the collapse bugs.