Fix JS issue with pins scrpit