corrected logout, threading issues