better connection polling, improve error logging