Add better check for elements' existence in latest block js