Fix unix/mac build error and wallet crash