Milk in Tubes

I was pumping last night with my Medela in the tote bag (I think its the pump in style advanced) and somehow milk got into the tubing and almost into my pump. The milk was backed up into the flange also

Any ideas on how this happened so i can prevent it next time?