fix for undefined doc.body