fix daemonization, cleanup, add read/write timeouts