Only serialize query if it's an array.

Fixes #49. Includes migration for records botched by this bug.
Merge branch 'hotfix/2.0.2'