Cache length in observesBefore for loop

Just spotted this.