I can't tell from your post, but if you focused on the moon through the tree limbs the camera undoubtedly locked onto the limbs and not the moon. Second, if you're using a long lens it'll be difficult or impossible to get both the moon and the tree sharp simultaneously. (added) If you want the moon sharp either focus directly on it and then turn off AF, or use manual focus and just set the lens at infinity. The first method is best for long lenses since the infinity focus will vary a bit with temperature.