Added unit test for server + fixes