Fix #584

@garyb Mind reviewing this one?