Fixed regressions and tests