Fix bug when pending module was not cleared on errors

- false circular dependency error was thrown for subsequent attempts to
  resolve the name module
Make module errors more clear