fixed resize_captions() function