Fixing Cannot cast 'groovy.lang.IntRange' to class 'int' issue