Safe changes

Various minor patches which should be applied without problems:
- typos
- type fixes
- small race condition