Update ats.js

At last fix the "slice null" bug.