Merge "Fix cursor memory leak"