Fix unit tests - definition and state pre-cache bug.