added select polling to client, fixed bugs