fixed segfault in lr