Weird crashy behavior when adding file