Fixing pin index error