Fix for #584
Test for #584