fixed withdrawing function