Fix bug in clearing newly added data or region layers