Proper cursor validity check.