fix a bug in cursor API