Fix typo and update code for PR #1

BTW not sure if the code should be copied in there by hand or if you have some way to build this stuff. It's just a bit sad to have code duplication.