make canvas sizing validity detection more robust