Fix for issue #10 as suggested by @ebaratte