heavy bugfixing