Some fixes to make PS work with the latest SDK code