added type checks