fixed a problem with the non tag interleaving case and fixed some issues with the tag replacement algorithm that were leading to segfaults