added check for jquery objects