some of my own patches, here for posterity