Updated serialization to accept classloaders