Fix access to db cursors