Add bounds checking to std for uneven matrices.