type problem v.2 and loop