add counter storage
fix bug