Added simple error checking for caption length