Fix issue #15, auto switch