fixed up the check for missing values function that prepares the data for the stack layout
fixed re-ordering of data layers