atoi: repair some bug(index out of range)