Fix type in stitch function