Fixed SwissTM algorithm hanging sometimes