You can't just check the type - you need to convert the valueref to a stringref.