Fix canvas size infinite loop (issue 24)