Fix some critical security errors and ensure that we're always working with the newest version of the inventory #2