Fixe for issue#584

this fixes #584. Sorry for the repeated comment edits. Just trying out github's feature of closing issues with PR :-)