added type check for maps