removeEventListener crashes

When calling the function to remove the event listener my application crashes and get the error:

Uncaught exception - Invalid field access : removeEventListener

Not sure if I am doing something wrong or is this is a problem with openFL. This is a sample of my code.:

class Main extends Sprite {
	
	public var backgroundsprite:Sprite;
        public function new () {
                addChild(backgroundsprite);

                backgroundsprite.addEventListener((MouseEvent.MOUSE_UP, clicked);
       }
.......
  //some function that calls the removeeventlistener
     private function disablelisteners():Void{
		trace('Disable listeners');

		

		 backgroundsprite.removeEventListener(MouseEvent.MOUSE_UP, clicked);
		
	}
     
}

I found my problem. I was overwriting the object further down in my code. When I tried removing the listener the object was no longer there so there was nothing to remove.