- fix idx = 0 bug