fix some bugs in array