Safeguarded database.js for tests, minor additions to admin controller