Fix segfault on test-crypto
Fix segfault on test-crypto

Plus random cleanups. This code needs help.

dreamllq/node,dreamllq/node,dreamllq/node,dreamllq/node,dreamllq/node,dreamllq/node,dreamllq/node,dreamllq/node,dreamllq/node