fixed 100% cpu usage by allowing read_bytes() to non-busily block until there are bytes to be read