Fix some ResourceManager bugs.