fixed wrong return value of type()