Fix SegFault when getting full path for files