railing fix in for loop