diff --git a/FHEM/01_FHEMWEB.pm b/FHEM/01_FHEMWEB.pm
index b282803..1c0a672 100755
--- a/FHEM/01_FHEMWEB.pm
+++ b/FHEM/01_FHEMWEB.pm
@@ -474,30 +474,8 @@ FW_answerCall($)
   $FW_plotmode = AttrVal($FW_wname, "plotmode", "SVG");
   $FW_plotsize = AttrVal($FW_wname, "plotsize", $FW_ss ? "480,160" :
                                                 $FW_tp ? "640,160" : "800,160");
-  ##############################
-  # Axels FHEMWEB modules...
-  if(defined($data{FWEXT})) {
-    foreach my $k (sort keys %{$data{FWEXT}}) {
-      if($arg =~ m/^$k/) {
-        no strict "refs";
-        #Returns undef if it already sent a HTTP header
-        ($FW_RETTYPE, $FW_RET) = &{$data{FWEXT}{$k}{FUNC}}($arg);
-        use strict "refs";
-        return defined($FW_RETTYPE) ? 0 : -1;
-      }
-    }
-  }
-
   my ($cmd, $cmddev) = FW_digestCgi($arg);
-  my $docmd = 0;
-  $docmd = 1 if($cmd && 
-                $cmd !~ /^showlog/ &&
-                $cmd !~ /^logwrapper/ &&
-                $cmd !~ /^toweblink/ &&
-                $cmd !~ /^style / &&
-                $cmd !~ /^edit/);
 
-  $FW_cmdret = $docmd ? FW_fC($cmd, $cmddev) : "";
 
   if($FW_inform) {      # Longpoll header
     $me->{inform} = ($FW_room ? $FW_room : $FW_inform);
@@ -510,7 +488,17 @@ FW_answerCall($)
     return -1;
   }
 
+  my $docmd = 0;
+  $docmd = 1 if($cmd &&
+                $cmd !~ /^showlog/ &&
+                $cmd !~ /^logwrapper/ &&
+                $cmd !~ /^toweblink/ &&
+                $cmd !~ /^style / &&
+                $cmd !~ /^edit/);
+
+  #If we are in XHR or json mode, execute the command directly
   if($FW_XHR || $FW_jsonp) {
+    $FW_cmdret = $docmd ? FW_fC($cmd, $cmddev) : "";
     $FW_RETTYPE = "text/plain; charset=$FW_encoding";
     if($FW_jsonp) {
       $FW_cmdret =~ s/'/\\'/g;
@@ -523,6 +511,23 @@ FW_answerCall($)
     return 0;
   }
 
+  ##############################
+  # Axels FHEMWEB modules...
+  if(defined($data{FWEXT})) {
+    foreach my $k (sort keys %{$data{FWEXT}}) {
+      if($arg =~ m/^$k/) {
+        no strict "refs";
+        #Returns undef if it already sent a HTTP header
+        ($FW_RETTYPE, $FW_RET) = &{$data{FWEXT}{$k}{FUNC}}($arg);
+        use strict "refs";
+        return defined($FW_RETTYPE) ? 0 : -1;
+      }
+    }
+  }
+
+  #Now execute the command
+  $FW_cmdret = $docmd ? FW_fC($cmd, $cmddev) : "";
+
   # Redirect after a command, to clean the browser URL window
   if($docmd && !$FW_cmdret && AttrVal($FW_wname, "redirectCmds", 1)) {
     my $tgt = $FW_ME;
@@ -640,7 +645,8 @@ FW_digestCgi($)
   $FW_inform = undef;
 
   %FW_webArgs = ();
-  $arg =~ s,^[?/],,;
+  #Remove (nongreedy) everything including the first '?'
+  $arg =~ s,^.*?[?],,;
   foreach my $pv (split("&", $arg)) {
     $pv =~ s/\+/ /g;
     $pv =~ s/%(..)/chr(hex($1))/ge;
diff --git a/FHEM/95_FLOORPLAN.pm b/FHEM/95_FLOORPLAN.pm
index 69624be..b8c9693 100644
--- a/FHEM/95_FLOORPLAN.pm
+++ b/FHEM/95_FLOORPLAN.pm
@@ -175,7 +175,7 @@ FP_CGI(){
   $FP_name = undef;
   my ($p,$v) = ("","");       #parameter and value of analyzed URL
   $FW_RET = "";               # blank out any html-code written so far by fhemweb
-#  $FW_longpoll = (AttrVal($FW_wname, "longpoll", undef));							# longpoll doesn't work (yet) for floorplans
+  $FW_longpoll = (AttrVal($FW_wname, "longpoll", undef));							# longpoll doesn't work (yet) for floorplans
   $FW_detail = 0;
   $FW_plotmode = AttrVal($FW_wname, "plotmode", "SVG");
   $FW_plotsize = AttrVal($FW_wname, "plotsize", $FW_ss ? "480,160" :
@@ -334,8 +334,6 @@ FP_htmlHeader($) {
   FW_pO "<script type=\"text/javascript\" src=\"$FW_ME/js/svg.js\"></script>"
                         if($FW_plotmode eq "SVG");
   FW_pO "<script type=\"text/javascript\" src=\"$FW_ME/js/fhemweb.js\"></script>";
-#  FW_pO "<script type=\"text/javascript\" src=\"$FW_ME/longpoll.js\"></script>"
-#                        if($FW_longpoll);											 # longpoll not yet implemented for floorplans
   FW_pO "</head>\n";
 }
 #-------------------------------------------------------------------------------
@@ -377,7 +375,8 @@ FP_show(){
   ### Page start
   FP_htmlHeader("$FP_name");
   ## body
-  FW_pO "<body id=\"$FP_name-body\">\n";
+  my $onload = $FW_longpoll ? "onload=\"FW_delayedStart()\"" : "";
+  FW_pO "<body id=\"$FP_name-body\" $onload>\n";
   FW_pO "<div id=\"backimg\" style=\"width: 99%; height: 99%;\">";
   FW_pO FW_makeImage(AttrVal($FP_name, "fp_backgroundimg", "fp_$FP_name"));
   FW_pO "</div>\n";
@@ -413,7 +412,7 @@ FP_show(){
 
 		FW_pO "\n<div style=\"position:absolute; top:".$top."px; left:".$left."px;\" id=\"div-$d\">";
 		FW_pO "<form method=\"get\" action=\"$FW_ME/floorplan/$FP_name/$d\" autocomplete=\"off\">";
-		FW_pO " <table class=\"$type fp_$FP_name\" id=\"$d\" align=\"center\">";               # Main table per device
+		FW_pO " <table class=\"$type fp_$FP_name\" id=\"table-$d\" align=\"center\">";               # Main table per device
 		my ($allSets, $cmdlist, $txt) = FW_devState($d, "");
 		#Debug "txt is \"$txt\"";
 		$txt = ReadingsVal($d, $text, "Undefined Reading $d-<b>$text</b>") if ($style == 3 || $style == 6);   # Style3+6 = DeviceReading given in $text
@@ -422,7 +421,7 @@ FP_show(){
     ########################
     # Device-name per device
 		if ($style gt 0 && $style ne 5) {
-			FW_pO "   <tr class=\"devicename fp_$FP_name\" id=\"$d\">";                        # For css: class=devicename, id=devicename
+			FW_pO "   <tr class=\"devicename fp_$FP_name\" id=\"$d-devicename\">";                        # For css: class=devicename, id=devicename
 			my $devName = "";
 			if ($style == 3 || $style == 6) {
 				$devName = $text2 ? $text2 : "";											   # Style 3 = Reading - use last part of comma-separated description
@@ -459,7 +458,7 @@ FP_show(){
 	
 	if ($style == 6) {                                                                    # add ReadingsTimeStamp for style 6
 		$txt="";
-    	FW_pO "<tr class=\"devicetimestamp fp_$FP_name\" id=\"$d\">";                     # For css: class=devicetimestamp, id=devicename
+    	FW_pO "<tr class=\"devicetimestamp fp_$FP_name\" id=\"$d-devicetimestamp\">";                     # For css: class=devicetimestamp, id=devicename
 		$txt = ReadingsTimestamp($d, $text, "Undefined Reading $d-<b>$text</b>") if ($style == 3 || $style == 6);   # Style3+6 = DeviceReading given in $text
 	    FW_pO "<td colspan=\"$cols\">$txt";
 	    FW_pO "</td></tr>";
@@ -473,9 +472,9 @@ FP_show(){
           my @cList = split(":", $cmdlist);
           my @rList = map { ReplaceEventMap($d,$_,1) } @cList;
           my $firstIdx = 0;
-		  FW_pO "  <tr class=\"devicecommands\" id=\"$d\">";
+          FW_pO "  <tr class=\"devicecommands\" id=\"$d-devicecommands\">";
           # Special handling (slider, dropdown)
-		  my $FW_room = undef;  ##needed to be able to reuse code from FHEMWEB
+          my $FW_room = undef;  ##needed to be able to reuse code from FHEMWEB
           my $cmd = $cList[0];
           if($allSets && $allSets =~ m/$cmd:([^ ]*)/) {
             my $values = $1;
