Fix race condition on writing public keys
Merge pull request #412 from btovar/lobster_fixes_2

Fix race condition on writing public keys