Added check before delete