Null error in javascript on error pages

This fix prevents error that arise when the environment element
is not present in the html. It uses a self invocation function
in order to free pointers from memory when parsing is completed.

New build is included in the PR.