Add check on html before caching to prevent error from undefined documentHTML