fix data races in controller

Fix #305
Dead code?