Quick fix for instance flattening code