Upper limit of for loop looked at nby for x,y,z

Instead of the appropriate nb*.