check that worker is defined to prevent crashing in older browsers