added more error logging when loading scripts