Fixed bug in indexset encoding