forward-port Philipp G├╝hring's changes (except for the cipher suite