fixed 'string indices must be integers' issues