Fixed problems with having multiple script documents