Fixes to AMP pipeline.

Introduced some problems with MASS, which still need to be sorted.