Fixed issue #54
Merge branch 'issue54'
Fixed issues #24, #20