bug fixes, added controller tests