Fix for #391, second attempt :)