Fixes issue #135, #130, #127