Advice on buying junkyard engines?

I've bought several vehicles from insurance company auctions for motors and transmissions, only got burned once. My thought is the car was almost guaranteed to be running and driving before the crash, so odds were good that it was mechanically sound.
Plus you get the whole vehicle, usually fairly cheap, and can recoup some of your money from parts you don't need.