fixed some bugs in older scripts