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...