make draw work in both standalone and embedded mode