Implemented setOption

+ various bugfixes