Fixed database permissions patches