Fixed bug so that canvas can be redrawn without refreshing the page