Fixed Segmentation Faults

Now It produces files correctly. Unfortunately the UVs are invalid.