more readable error when serializing modules

Perhaps a more reasonable alternative to #76 - this way it's clear what's going on when serializing a module doesn't work...
Would it be useful to include the name of the module someone tried to serialize?