re-sync fixes from standalone version