fixed bug in creating canvas