fixed bug #112 and #114