Fixed issue 19

With this fix I tested all examples from the repository.