Bugfixes and 4.0 launch preparation