fix canvas function