Fix implementation of join_single_pixel_chains