add counter flag and init method