Fixed another bug when executing scripts