fix index action, add guard for invalid id for delete