Fixed issue #13
Merged with latest master