Add error handle and log