Fixed logic for waggon assignation