upstream fixes from zenphoto.org

Also some fixes and removal of the setup-primitive script