Make local mode work again and fix a few bugs

Auditors: eater, cbhl