More bugfix

 - fix bug with condition of before_close
 - fix proc checking
 - fix locals parameters in render template
 - fix path to gem view
 - add html_safe for parameters with js-code