fixed retrieve bug

retrieving seriesids only seemed to always get only one seriesid per show. that
was because only the first id was considered now it looks at all ids.

i also added a simple check for when json strings can't be encoded properly.