fixed a bug in script