add read/write timeouts and fixes