Bug fixes

ID returned after a GET was actually the database name.
Other fixes to prevent some PHP notices from popping up.