Fixed bugs in minimum script. H/T to Geoff Bunza for finding them!