Fix output array indexing in hazard calculations