Thanks to @pauldijou. Fix #39.
Thanks to @pauldijou again. Fix #40.
Thanks @pauldijou. You did a hat-trick by finding three bugs in one day! Fix #41.