Fixes #111, #103.