ISPN-2300 Fix conditional operations to work with versioned caches

As explained in https://issues.jboss.org/browse/ISPN-2300, other fixes were considered including Pedro's but none except the one submitted managed to pass the entire core/ testsuite. So, if you're gonna suggest an alternative fix, make sure you test it before :)