fix the bug to throw out the image with no associated .mat output