rescale() handles non-finite values better (issue 341)