Fix other errors, add error logging