update streams implement detach method
improve openssl error handling