fixing bug in script.