Re #925 - better handling on failed record retrievel + some code
cleaning