tuning and bugfixing