Added tests for external reference file amdloaders.
Fix infinite loop in sharedStart().