Fix problems in tests, fix issue in server.c (bug 581)