Fix bugs in joining and quitting caused by working with the wrong data