backport lsr patches from v3.7.x branch

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>