Small fixes for dynamically loaded scripts