Applying patch suggested by https://github.com/KciNKh to fix issue #14