bunch of bugfixs