Fix database name defaulting (was using str_replace instead of preg_replace).