fixed database issues and admin functionality