Thanks for the reply.
Yes, I did console.log the cursor variable to see that it was set correctly and it was.