Add check to create class if it is an array, fix custom type sanitation