bugfixing
more bughunting
rm dead code