invalid cursor type usage bug fix