Various fixes
Merge branch 'master' into peercoin