Error in supposedly correct script

Please do use code tags, makes things so much easier to read.