Fix for script errors caused by no elements on pag