It is hard to prevent foaming[1]. You just need to use a larger flask[2] until the foaming has stopped, then change to a smaller.
[1] Using a lower vacuum gives less foaming, but this is not always suitable.
[2] Or divide your mixture into several portions and process separately.
http://rhodium.lycaeum.org (http://rhodium.lycaeum.org)