Fixed NullPointerException in JavaScript handling when script is not
inline