Controller tests

And fixes for tests