Adding a short sleep before the second attempt at connection creation is done seems to significantly improve the reliability of the test.
Fixed missing newlines in the error output printf calls of sync_slaves. Changed the order of commands pers_02 executes to a more correct way.