Fixing caption.text null error