Fixes for proper connection handling with phantomjs & in browser script execution handling