openssl heartbleed fix and some other bug fixes from upstream