Fixed some errors and made the example work again

New patch replacing #68