fixed silly bug with iterating on wrong dimension