Fixes bug with switchs