Fixed tests
Improve server main