Fixes issue 30. Thanks @mandric