Just realised that the images with bad focus are probably images where the right filter was not set. This should be checked by comparing flux, phase and focus (3 Fs ..). Could perhaps be used as a method to select only those images taken with known filter.