Fixed a bug when running JavaScript