more bug fixes for #112