code to load AO files (now with cleaner error reporting)