fix #594, error when no document.body is available