Fixes bug in #20: Double application of function

*sigh* my pull request #20 to fix #17 seems to be broken, this is to fix this.