fix Canny segfault