Fixed bug in key initialization.