The transmission of fast molecular ions through thin foils