Serialization fails with non-default class loader.

This is fix for #16.