Fix serializer equality checks and add tests.