Pagemod listener doesn't work the first time

So I have a rather unique problem with a plugin I’m developing. The plugin’s main.js file launches a pagemod which is supposed to send data back when the user pastes into a field. It works! But only from the second time the user pastes on that page onward. The first time is ignored. Any idea why?

main.js code:

var clipboard = require("sdk/clipboard");
var mypageMod = require("sdk/page-mod");
mypageMod.PageMod({
	include: "http://mydomain.com/edit.php**",
	contentScriptFile: [data.url("jquery.min.js"),data.url("pagemod-script.js")],
	onAttach: function(worker) {
		worker.port.on('bompasted', function(ext) {
		var clipdata = decodeURIComponent(clipboard.get());
		
		if (clipboard.currentFlavors.indexOf("image") != -1) {
		console.log('got it!');
		}
		});
	}
}); 

pagemod-script.js code:

 $('iframe').each(function () {
        $(this).contents().find('body').on('paste', function (e) {
			
			var myevent = e.originalEvent;
			console.log("event: " + myevent.clipboardData.types[0]);
				if (myevent.clipboardData.types[0] == undefined) {
			e.preventDefault();	
			var ext = "jpg";
			self.port.emit("bompasted",ext);
				}
				
		
        });
    })

Do you see any errors in the console? Do you know if the event listener is being called at all?