Fix handleError function on chart pages