Merge in from aptivate

Needed fixes for conditions