added terminal error logging