Fix issue and add tests for bug where saving and loading a signing key caused a stack trace, se issue #18