Fix bug in clear()