Small optimisation and fix script