Fix a bug in filter_serialize () and update tests.