delete_elem func