Fixed minor bug in script