bugfixes from recent commits