fixing range statement