Michael: fixed the addition of duplicate states when expanding states