one more bug: index started from 2 but should be from 1