fix logic for updating global secondary indexes