reformat and fix array index bug