added a couple of utility methods and fixed issues with cursors in collect