Fixed script issue in dbadmin

Just look at the last commit. The others are there because I based this change off of QA which has already had a fix applied (the Push Null Ref, issue 1050).

Fixes #1057