Blackberry webworks EmailListener
===

I've been working on a project (my first blackberry project)
Most of the application is working, when I get a mail a page pops up on the screen and it vibrates a little.
The problem I have is that I'm unable to get the MessageObject from the callback function.
I am using this API: https://github.com/blackberry/WebWorks-Community-APIs/tree/master/Smartphone/EmailListener

And below you can see my listener.html

    <html>
    <head>
	<meta name="viewport" id="viewport" content="height=device-height,width=device-width,user-scalable=no" />
	<link rel="stylesheet" type="text/css" href="styles.css" />
	<script type="text/javascript" src="listener.js"></script>
    <script type="text/javascript">
	webworks.message.email.startListening("", handleMessage);
	
	function handleMessage(servicename, msgObject){
		window.localStorage.removeItem("subject");
		
		if(typeof(msgObject) !== 'undefined' && msgObject != null) {
			window.localStorage.setItem("subject",msgObject.subject);
		}
		else if(typeof(msgObject) === 'undefined')
		{
			window.localStorage.setItem("subject","undefined!");<--This happens
		}
		else if(msgObject == null)
		{
			window.localStorage.setItem("subject","null!!");
		}
		else
		{
			window.localStorage.setItem("subject","I donno :<");
		}

		window.location = "index.html";
	}
    </script>
    </head>
    <body>
    </body>
</html>

And my config.xml:

    <widget xmlns="http://www.w3.org/ns/widgets"
        xmlns:rim="http://www.blackberry.com/ns/widgets"
        version="1.0.0.0" id="Weo">  
       <name>Weo</name>
       <description>Project weo</description>
       <author>Emil Olofsson</author>
       <content src="index.html" rim:allowInvokeParams="true">
           <rim:background src="listener.html" runOnStartup="true" />
       </content>
       <rim:orientation mode="portrait" />
       <rim:navigation mode="focus" />
        <icon src="images/icon.png"/>
	    <feature id="webworks.message.email" />
	    <feature id="blackberry.message" />
	    <feature id="blackberry.app.event" />
	    <feature id="blackberry.app" />	
	    <feature id="webworks.bbalert.led" required="true" version="1.0.0.0"/>
	    <feature id="webworks.bbalert.vibrate" required="true" version="1.0.0.0"/>
	    <feature id="blackberry.utils" />
	    <feature id="blackberry.system.event" />
    </widget>

The MessageObject is undefined on callback and I have been unable to figure out why. As I said everything else works, the application triggers on incoming email.

Is there something special I need to do to be able to pass parameters between an webworks extension and the javaScript.

Thanks for any assistance.
Cheers Emil