error checking in gems