better error handling while module loading