fixed a little bug which sometimes duplicate some elements