Add simple test script. Fix a few problems in corgi.