[ES5] Enforce better type checking and limit range of counter