Fix index bin calculation