Fix clear() function not working