Optimize CAS
More fixes