Fix boolean serialization

Fixes #890