Fixed canvas initialization bug