bug fixes in contains()