fixed a bug in index / position setting