Automatic learning mechanisms for flexible human locomotion