Use toArray() rather than deprecated raw()

Sorry for the mess around, there's no mention of it being deprecated in the API docs, but it does say so in the code.