Fix some problems with the sample code in the docs