pass cursor instead of conn