Germany agrees new measures to stem flow of migrants