Fix #111 and #112