Fix keep all tagged logic

Finally did some proper testing of -km options (fixed plenty of bugs in the process although no dangerous ones)