Fix Thread safe error on Cipher strategy
(https://github.com/hdiv/hdiv/issues/23).
Some code formatting.