Fix the battery capacity calculation logic