Fix some db access issues and add a real inventory