I dont see problem with the script… the error usually points to specific line so pls show us screenshot.