cleanup in proc written