Fix some bugs and add some configuration options