cursor: Clean up code flow slightly

Reverse the set of expressions so testing for gbm is at the top.
Make gbm optional

Now it's only required by the native backend. The cursor code is getting
quite messy, but it was already considerable messy to start with.