Fixed various bugs in CDF to pass vectorized unit-tests.