Fix issues #111 and #98