add another error logging code for debugging purpose