Bug fixes for lr test