added some useful type checks to the various extract methods