Fix inventory calculation