Lots more debug output and some fixes for withdrawing