fixing canvas bug