Better error handling for module loading