segmentation fail in flipH function