Fix various things and tests to be launched with PhantomJS