fix error checking
update examples