Fixed array index problem in cursor utils