Make sure the element exists before trying to use it