Fixing issue 12

passed integration tests  fixes #4