Fix logic inside delete endpoint.