Fix an array over-run when tokenising scripts