fixed canvas variables and created a check