XNAT-3328 Fixed database connection issue in automation library, cleaned up code in extractor.