added patch from flaviu

Original shr code sucked anyway