Moved (back) error and console redirection to start o JS code.