Improve tests a bit
Fix multiple insertions after several table switches (with test)