Fix #239 improve switch buffer behavior