Rewrite code for merging contours
Workaround against corrupted CFF