Controller fixes

Some commits extracted from #186.