fix cursor leak