Clm sdm fixes

Unfortunately, we are blocking on this. So we are going to make a deal with the devil and pull it in to master...

Psssst... @nontas could you edit this text to say what these changes actually do?