avoid canvas flicker