Fixed an issue when collapse() is called again