I think it would be better to check the counts of the query sets in order to avoid try/except blocks... I'm guessing that's where you got an IndexError, trying to update a null set of indices?