Cache improvements, make tests pass again