BUGFIX: several bugfixes