added logging on error