Update benchmark code to be more robust, and fix bug in logout procedure

Title says it all.  These changes are for good, I say! :)