Fix setting port for DB when in automatic mode