wrapped add js file function call with check if file exists for custom templates getting js errors