added type check