fixed bugs in setting prefered input