fixed: checking wrong variable
implemented CAS support #6