fix privkey handling, switch wallet bugs