security fixes from Litecoin v0.8.5.1