Some small fixes

Check commit messages for details.