Fixed most failing tests.
Added example for issue #45