fixed an error on the clear functions