tweaking and bugfixing