fixed saving previous wrong state CDB-1496