fixed some bugs in preference