Bugfixes mentioned by @dietereve