Fix setDevice problem