Fixes issue 518

Fixes #518