fixed the caption bug by adding a conditional