Make sample run a bit more robust