set correct slave port from env

>groovy.lang.MissingPropertyException: No such property: env for class: tcp-slave-agent-port
diff --git a/init.groovy b/init.groovy
index 2f9f129..db8aae2 100644
--- a/init.groovy
+++ b/init.groovy
@@ -5,6 +5,8 @@
 Thread.start {
       sleep 10000
       println "--> setting agent port for jnlp"
-      Jenkins.instance.setSlaveAgentPort(env['JENKINS_SLAVE_AGENT_PORT'])
+      def env = System.getenv()
+      int port = env['JENKINS_SLAVE_AGENT_PORT'].toInteger()
+      Jenkins.instance.setSlaveAgentPort(port)
       println "--> setting agent port for jnlp... done"
 }