Fix CAS implementation (again)