Fixing race condition and other mistakes. Fixes #1603.

// FREEBIE
same alignment, to parens