fix bugs in docs and examples