Fix undefined $dbname variable

Change-Id: If1d6ec88d0a1459230835821367460b3bc437e49