Fixed functional tests. Fixed minor issues.