fix bug by close cursor