Hey!
After examining the plugin’s code I think I got what is causing the problem. In line #669 of plugin.php
$x = strrpos($buffer, '</body>');
you got everything that is before the closing body tag and in line #671
$buffer = substr($buffer, 0, $x) . $script . '</body></html>';
you are placing the $script inside $buffer but what about the scripts that are between </body> and </html>? That part never gets in the $buffer.
Please let me know if you come up with a solution
Thanks!