Reimplement options caching

fix #123
fix #125