fixed server auth problems, closing file handles and suchforth