-added catch in case an exception occurs before a cursor is created.