fix bug in pin index