fixed a bug in adaptive script