reference cleanup