many small changes and bugfixes