update and bug fix battery.sh