Fixed bug in module_fail. Consistent error handling.