server: fix double increment in for loop