i am not sure this works, $type is an Instance of Type here in my opinion. you should cast it to (string) to be sure.