related to issue #112
related to issue #112: fixed a few bugs