work for constructor and clear()