More error checking, slight fix

Added more error checking, fixed a slight issue with cards replaced, but
it shouldn't have effected much really.