fixed the not working clear-function