Why are you checking for element == null. This should never happen.