Fix bugs in exception serializer.