fixed some database issues