Fixed bug in script