Fix issues listed in #1