Fixes tests. Improve test performance