fix the deletion of codes