fixed get size and type error, implemented onLoadedState