Use same serialize function for query.
Corrected bug in serializing false.
Added more acceptance tests.