Fixed the bug. Now all examples return correct results.