check for batteries in function