Bugfix in integration and code tweaks