Previously, if two identical entities appeared in one string, only the first would get decoded. This fixes that bug.