better error msgs and more tests for polyfns