Fixed error messages not being redirected to logfile