$col variable is undefined in its scope