Fix bugs in code samples