problem storing preview state in custom output node


I’m building a new export operator that can write out either tiled or single images.
All works fine except the preview.

I’m calling: StoreOutputContents(output_set, output, P_PREVIEW); at the end of my activate function.
This works well the the moment the node is connected for the first time,
but after I change one of my parameters on the node itself and press OK, the node status turns red.
It doesn’t enter the activate code block at that point. By changing any of the settings on nodes that lead up to the export, the status turns yellow (which is okay).
Also, by changing any of the parameters on the node, the data temporarely cooks. It’s only when I press OK, that my node ‘errors’ (turns red)
Is there any reason for this behaviour or am I doing something wrong?

Is there someone that can help me out with this problem?
Managed to get the node export both RGB images and height maps (regular and tiled) but am unable to get the preview right.

The activate call looks like this:

bool GFileOut::Activate(BuildContext &context)
HField *output = NULL;

output = HF(RetrieveData(0, context));
if (!output)
	return false;

OutputSet output_set(output);
if (context.pstate != P_PREVIEW && GEX_EXPORT_NODE) 
	GFileOut::EXPORT_STATUS = true;
	doOutput(output_set, OUTPUT_NORMAL);

// Store our output content
if (output_set.num() > 0)
	StoreOutputContents(output_set, output, context.pstate);

return true;


I assume the isExporting call has nothing to do with the preview?

Any help would be appreciated!