ref cleanup