make loop possible

fix some bugs to make loop possible, to support array and hash table