Fix "origin: function" case with tests

PR #12 introduced a bug for the case that options.orign is a function.