improved librat patches