Fixed issue #23
Partial fix for issue #24