Bugfix in flock on generateKey
Fixed bug in generate key with flock