added ref counting to assets to deal with cleanup