Fix bugs in balance and delete