Fixed a bug that edge weights are not assigned correctly when lowering switch statement.