fixed break on inner select when meant for outer for loop
allow clients to safely disconnect
fixed eof issue on disconnect