add error log machanism