fixed the loading and unloading of assets

also fixed a threading issue that was not apparent on the windows
client that popped up in the mac client, due to accessing namespaces in
static global scope.