Fix for repeated test and PHPT (fixes #1118)