Fixed cache bug.
Fixed wrapped compilation bug. Added regression test.