fix bug for viewleave