Bug in script fixed