Regression was introduced in 4cc6421daa, however it was working before only due to grid.len() bug.
4cc6421daa