Fix span not closed correctly