some major bugfixing