diagonal tests and bugfixing