general fixes

Sorry, forgot to rebase. Real changes are only in today patches.