quality metric and bugfixes