fix encrypted lib index off by one bug