Fix for "Illegal string offset 'tag'" error