Improvements to support phantonJS testing