fix another script problem and a bit of spelunking