some bugfixes for the case integrity script