keep one’s wits about one

be alert and able to deal with difficulties