Changes needed for making it work on PhantomJS.
Merge branch 'phantomjs' into peerlibrary
Revert "Changes needed for making it work on PhantomJS."

This reverts commit 7b3b6222a3f3b5edb6683c7db36e6ea5ea65418b.
Changes needed for making it work on PhantomJS.