fix bug, add error logging