massive bugfixes