fix errors in new inventory management code