improvement and bugfixes