Fixed some minor database issues