modification to serialize to treat booleans better