Fix entity deletion