fix tidy script and tidy up broken files