Improve functional tests