Fix issue #4
Partial fix for issue #5