Fixed a bug in the preferance handling