Fix issues in battery func.