Added check for width and height in localStorage and on canvas