fix bug in getting cluster ids

previously was wrong in the case that the id had a '-' in it, which is the case for the autogenerated ids.