sync headless code from bb