last bugfixes, adds preferences