minor cleanups, delay compactinventory call to avoid reference issues, painmat_strength variable