[Bug] write controller tests
[Bug] some fixes