fixed race canvas bug