Fix bugs and improve AssetsManager and its test case