make sure crypto consts get initialized first
fixed incorrect memory access
Merge pull request #4 from orignal/master

update