will run in error if cursor is empty