Fixes for various tools

See individual commits for details.