Fixes #682. Fixes #683. Other stuff.