implement prepared stmt recovery mechanism