Revert prima to v3.1.7.16 (sqashed to 53adc8c28e80c1fc5ce5073e210ae3e2dc959df7)