More changes to inventory

changed some more things in inventory. Fixed some of the error handling.
Merge remote-tracking branch 'origin/master'

Conflicts:
	gallerydb.php