Minor fixes to code samples

Some imports were missing and in the second sample an uninstantiated variable which I believe is the instance from before is used.