fix canvas clear function