Further fixes for issues #96 and #112